package com.bootdo.xiao.suggest;

/**
 * @Auther: liuj
 * @Date: 2019/5/22 17:46
 * @Description:便让null值和空值威胁到变长方法
 */
public class Suggest5 {
    private void methodA(String str, Integer...i){
        System.out.println(str + "methodA Integer");
    }

    private void methodA(String str, String...s){
        System.out.println(str + "methodA String");
    }

    public static void main(String[] args){
        Suggest5 suggest5 = new Suggest5();
        String str = "china";
        String[] str1 =  null;
        //调用methodA Integer
        suggest5.methodA(str, 0);
        //调用methodA String
        suggest5.methodA(str,"people");
        //编译不通过，第二个参数为null，编译器无法确定调用哪个方法
//        suggest5.methodA(str);
//        suggest5.methodA(str， null);
        //null值也是有差异的，定义为字符串数组的null，调用methodA String
        suggest5.methodA(str,str1);
    }
}
